class Queue(object):
    def __init__(self):
        self.entries = []    # 表示队列内的参数
        self.length = 0      # 队列长度
        self.front = 0       # 队列头部位置

    def enqueue(self, item):
        self.entries.append(item)      # 添加元素
        self.length = self.length + 1  # 队列长度加1

    def dequeue(self):
        self.length = self.length - 1   # 队列长度减1
        dequeued = self.entries[self.front]  # 删除队首元素
        self.front += 1               # 队首位置减1
        self.entries = self.entries[self.front:]  # 更新队列为退队之后的队列
        return dequeued

    def peek(self):
        # 直接返回队列的队首元素
        return self.entries[0]
